package com.panda.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panda.dao.UserDao;
import com.panda.entity.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    private UserDao userDao;
//    @Autowired
//    public JdbcTemplate template;

    public UserInfo findUser(UserInfo info) {
        QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("name", info.getName());
        queryWrapper.eq("id", info.getId());
        return userDao.selectOne(queryWrapper);
//        return template.queryForObject("select * from user where id = ? and name = ?",
//                new Object[]{info.getId(), info.getName()}, new BeanPropertyRowMapper<>(UserInfo.class));
    }
}
